package com.sqx.modules.scTableColumn.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.scTableColumn.service.ScTableColumnService;
import com.sqx.modules.scTableColumn.vo.JsonRootBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@Api(value = "模板管理", tags = {"管理端-模板管理"})
@RequestMapping(value = "/admin/scTableColumn/")
public class AdminScTableColumnController {

    @Autowired
    private ScTableColumnService columnService;

    @ApiOperation("添加|修改模板")
    @PostMapping("insertScTable")
    public Result insertScTable(@ApiParam("分类id")@RequestBody JsonRootBean jsonRootBean) {
        return columnService.insertScTable(jsonRootBean);
    }

    @ApiOperation("用分类查询模板")
    @GetMapping("getTableByClassId")
    public Result getTableByClassId(@ApiParam("分类id")Long typeId){
        return Result.success().put("data", columnService.getTableByTypeId(typeId));
    }
    @ApiOperation("删除模板")
    @GetMapping("deleteTableByClassId")
    public Result deleteTableByClassId(@ApiParam("分类id")Long typeId){
        return columnService.deleteTableByTypeId(typeId);
    }
}
